from flask import Flask
from flask_cors import CORS
from common.models import db
from views.users import user_bp
from views.oauth_user import oauth_user_bp
from views.coures import course_bp
from views.comment import comment_bp
from views.user_all import user_all_bp


# 注册app以及调用
def create_flask_app(config):
    app = Flask(__name__)
    app.config.from_object(config)
    db.init_app(app)

    cors = CORS(app)

    # 注册蓝图
    app.register_blueprint(user_bp)
    app.register_blueprint(oauth_user_bp)
    app.register_blueprint(course_bp)
    app.register_blueprint(comment_bp)
    app.register_blueprint(user_all_bp)


    return app


















